package com.xuecheng.ucenter.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Component;

/**
 * @Author xiao
 * @Date 2024/12/23 上午 9:12
 * @ClassName: DaoAuthenticationProviderCustom
 * @Description: 重写additionalAuthenticationChecks方法 实现自定义密码等方式的校验
 */
@Component
public class DaoAuthenticationProviderCustom extends DaoAuthenticationProvider {

    @Autowired
    public void setUserDetailsService(UserDetailsService userDetailsService) {
        //实际上注入的是我们的实现类UserServiceImpl
        super.setUserDetailsService(userDetailsService);
    }
    // 屏蔽框架的密码对比,用自定义方法进行校验
    @Override
    protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {

    }
}
